package com.smart.car.common.res;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.text.ParseException;
import java.util.Date;

/**
 * @Description: TODO
 * @author: zoutao
 * @date: 2021-04-23-13:47
 */
public class DateTest {


    public static void main(String[] args) throws ParseException {
        String dateStr  = "2020-03-01";
        DateTime dateTime = DateUtil.parse(dateStr);
        Date date = DateUtil.parse(dateStr);

        String dateStr2  = "2020-03-01 10:24:25";
        Date date2 = DateUtil.parse(dateStr2, "yyyy-MM-dd HH:mm:ss");
        String formatDate = DateUtil.formatDate(date2);
        System.out.println("dateTime3 = " + formatDate);


        String dateStr3  = "2020-03-01T10:24:25";
        Date date4 = DateUtil.parse(dateStr3, "yyy-MM-dd'T'HH:mm:ss");
        System.out.println("date4 = " + date4);

    }
}
